package com.chinanet.config;

import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;

@Configuration
public class DataSourceConfig {
    @Bean(name = "mysqlDataSource")
    @Qualifier(value = "mysqlDataSource")
    @ConfigurationProperties(prefix = "spring.primary.datasource")
    public DataSource mysqlDataSource(){
        return DataSourceBuilder.create().build();
    }
}